package com.zqxq.lottery.entity.constant;


import java.util.*;

/**
 * 说    明：   足球--值规则
 *  胜平负、让球胜平负、比分、总进球、半全场、混合投注 只能进行闯关投注，不能单关；场次>=2
 *  单关投注 可单关和N串1的方式投注且 场次<=8
 *
 *
 *
 * 创 建 人：	一刀·胡
 * 创建时间：	2018/5/3 13:50
 * 修 改 人：
 * 修改日期：
 **/
public class FootBallRule {

    //选球投注号对应比赛结果 APP端
    public static Map<Integer, String> scoreMap = new HashMap();
    //比赛结果对应投注号 后端
    public static Map<String, Integer> ballMap = new HashMap();
    //胜平负
    public static final Integer[] spfKey = {0,1,2};
    //让球胜平负
    public static final Integer[] rqspfKey = {3,4,5};
    //半全场
    public static final Integer[] bqcKey = {6,7,8,9,10,11,12,13,14};
    //比分
    public static final Integer[] bfKey = {15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45};
    //总进球
    public static final Integer[] zjqKey = {46,47,48,49,50,51,52,53};
    //串玩法
    public static final String[] bunchKey = {
            "2-1","3-1","4-1","5-1","6-1","7-1","8-1",
            "3-3","3-4",
            "4-4","4-5","4-6","4-11",
            "5-5","5-6","5-10","5-16","5-20","5-26",
            "6-6","6-7","6-15","6-20","6-22","6-35","6-42","6-50","6-57",
            "7-7","7-8","7-21","7-35","7-120",
            "8-8","8-9","8-28","8-56","8-70","8-247"
    };
    public static List<List<BallBunch>> bunchList = new ArrayList();
    public static Map<Integer,List<BallBunch>> bunchMap = new HashMap();

    static {
        //胜平负
        scoreMap.put(0, "胜");//胜
        scoreMap.put(1, "平");//平
        scoreMap.put(2, "负");//负
        //让球胜平负
        scoreMap.put(3, "让球胜");//让球胜
        scoreMap.put(4, "让球平");//让球平
        scoreMap.put(5, "让球负");//让球负
        //半全场
        scoreMap.put(6, "胜胜");
        scoreMap.put(7, "胜平");
        scoreMap.put(8, "胜负");
        scoreMap.put(9, "平胜");
        scoreMap.put(10, "平平");
        scoreMap.put(11, "平负");
        scoreMap.put(12, "负胜");
        scoreMap.put(13, "负平");
        scoreMap.put(14, "负负");
        //比分-胜
        scoreMap.put(15, "1:0");
        scoreMap.put(16, "2:0");
        scoreMap.put(17, "2:1");
        scoreMap.put(18, "3:0");
        scoreMap.put(19, "3:1");
        scoreMap.put(20, "3:2");
        scoreMap.put(21, "4:0");
        scoreMap.put(22, "4:1");
        scoreMap.put(23, "4:2");
        scoreMap.put(24, "5:0");
        scoreMap.put(25, "5:1");
        scoreMap.put(26, "5:2");
        scoreMap.put(27, "胜其他");
        //比分-平
        scoreMap.put(28, "0:0");
        scoreMap.put(29, "1:1");
        scoreMap.put(30, "2:2");
        scoreMap.put(31, "3:3");
        scoreMap.put(32, "平其他");
        //比分-负
        scoreMap.put(33, "0:1");
        scoreMap.put(34, "0:2");
        scoreMap.put(35, "1:2");
        scoreMap.put(36, "0:3");
        scoreMap.put(37, "1:3");
        scoreMap.put(38, "2:3");
        scoreMap.put(39, "0:4");
        scoreMap.put(40, "1:4");
        scoreMap.put(41, "2:4");
        scoreMap.put(42, "0:5");
        scoreMap.put(43, "1:5");
        scoreMap.put(44, "2:5");
        scoreMap.put(45, "负其他");
        //总进球
        scoreMap.put(46, "0");
        scoreMap.put(47, "1");
        scoreMap.put(48, "2");
        scoreMap.put(49, "3");
        scoreMap.put(50, "4");
        scoreMap.put(51, "5");
        scoreMap.put(52, "6");
        scoreMap.put(53, "7+");
        //***********************************************************************************************
        //胜平负
        ballMap.put("胜",0);//胜
        ballMap.put("平",1);//平
        ballMap.put("负",2);//负
        //让球胜平负
        ballMap.put("让球胜",3);//让球胜
        ballMap.put("让球平",4);//让球平
        ballMap.put("让球负",5);//让球负
        //半全场
        ballMap.put("胜胜",6);
        ballMap.put("胜平",7);
        ballMap.put("胜负",8);
        ballMap.put("平胜",9);
        ballMap.put("平平",10);
        ballMap.put("平负",11);
        ballMap.put("负胜",12);
        ballMap.put("负平",13);
        ballMap.put("负负",14);
        //比分-胜
        ballMap.put("1:0",15);
        ballMap.put("2:0",16);
        ballMap.put("2:1",17);
        ballMap.put("3:0",18);
        ballMap.put("3:1",19);
        ballMap.put("3:2",20);
        ballMap.put("4:0",21);
        ballMap.put("4:1",22);
        ballMap.put("4:2",23);
        ballMap.put("5:0",24);
        ballMap.put("5:1",25);
        ballMap.put("5:2",26);
        ballMap.put("胜其他",27);
        //比分-平
        ballMap.put("0:0",28);
        ballMap.put("1:1",29);
        ballMap.put("2:2",30);
        ballMap.put("3:3",31);
        ballMap.put("平其他",32);
        //比分-负
        ballMap.put("0:1",33);
        ballMap.put("0:2",34);
        ballMap.put("1:2",35);
        ballMap.put("0:3",36);
        ballMap.put("1:3",37);
        ballMap.put("2:3",38);
        ballMap.put("0:4",39);
        ballMap.put("1:4",40);
        ballMap.put("2:4",41);
        ballMap.put("0:5",42);
        ballMap.put("1:5",43);
        ballMap.put("2:5",44);
        ballMap.put("负其他",45);
        //总进球
        ballMap.put("0",46);
        ballMap.put("1",47);
        ballMap.put("2",48);
        ballMap.put("3",49);
        ballMap.put("4",50);
        ballMap.put("5",51);
        ballMap.put("6",52);
        ballMap.put("7+",53);

        for(int i =0;i<9;i++){
            bunchList.add(new ArrayList());
        }
        bunchMap.put(1,new ArrayList());
        bunchMap.put(2,new ArrayList());
        for(String bunch:bunchKey){
            if(bunch.endsWith("-1")){
                bunchList.get(1).add(new BallBunch(bunch,bunch.replace("-","串")));
                continue;
            }
            if(bunch.startsWith("2-")){
                bunchList.get(2).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
            if(bunch.startsWith("3-")){
                bunchList.get(3).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
            if(bunch.startsWith("4-")){
                bunchList.get(4).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
            if(bunch.startsWith("5-")){
                bunchList.get(5).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
            if(bunch.startsWith("6-")){
                bunchList.get(6).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
            if(bunch.startsWith("7-")){
                bunchList.get(7).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
            if(bunch.startsWith("8-")){
                bunchList.get(8).add(new BallBunch(bunch,bunch.replace("-","串")));
            }
        }

    }

    /**
     * 说    明：
     * @param matchNum 场次个数
     * @param isdg 是否支持单关
     * 创 建 人：	一刀·胡
     * 创建时间：	2018/5/3 16:03
     * 修 改 人：
     * 修改日期：
     **/
    public static Map<Integer,List<BallBunch>> getBallBunch(int matchNum,boolean isdg){
        bunchMap.get(1).clear();
        bunchMap.get(2).clear();
        if(isdg){
            bunchMap.get(1).add(new BallBunch("1-1","单关"));
        }
        bunchMap.get(1).addAll(bunchList.get(1).subList(0,matchNum-1));
        for(int m=3;m<=matchNum;m++){
            bunchMap.get(2).addAll(bunchList.get(m));
        }
        return bunchMap;
    }



    public static void main(String[] args) {
        Map<Integer,List<BallBunch>> map = FootBallRule.getBallBunch(5,false);
        List<BallBunch> list = map.get(1);
        for(BallBunch b:list){
            System.out.println(b);
        }
        System.out.println("***********************************");
        List<BallBunch> list2 = map.get(2);
        for(BallBunch b:list2){
            System.out.println(b);
        }
        //System.out.println(getScoreMap(12));
    }


}